#include "StdAfx.h"
#include "timeinfo.h"

#include <string>



TimeInfo::TimeInfo()
{
	TotalFrame=0 ;
	PreCordTime=0 ;
	TimePass=0 ;
	PreFrame=0 ;
	FPS=0;
}

float TimeInfo::GetTimePass()
{
	return TimePass;
}

void TimeInfo::Work(HWND hWnd)
{
	int CurTime = GetTickCount();
	if(PreFrame != 0)
		TimePass = (CurTime-PreFrame)/1000.0f;
	else
		TimePass = 0;

	PreFrame = CurTime;



	//TotalFrame++;
	//if(TotalFrame == 5)
	//{
	//	CurTime = GetTickCount();
	//	int FPS = (1000*TotalFrame)/(CurTime-PreCordTime);
	//	PreCordTime=CurTime;
	//	TotalFrame = 0;

	//	char buf[256];
	//	sprintf_s(buf,sizeof(buf),"FPS:%d",FPS);
	//	SetWindowTextA(hWnd,buf);
	//}
}

